package com.huixue.zdb.controller;


import com.huixue.zdb.pojo.Biuding;
import com.huixue.zdb.pojo.ZdbUser;
import com.huixue.zdb.service.ISiteaService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * <p>
 * 站点表 前端控制器
 * </p>
 *
 * @author ZhouHuRun
 * @since 2020-09-23
 */
@Controller
@RequestMapping("/sitea")
public class SiteaController {

    @Autowired
    ISiteaService iSiteaService;
    @GetMapping("/siteenter")
    public String user(){
        ZdbUser zdbUser = new ZdbUser(); //获取用户对象
        Integer schoolid = zdbUser.getSchoolid(); //获取用户的站点id
        Biuding biuding = new Biuding();//获取站点对象
        String s = biuding.getsId();//获取站点信息
        if (schoolid.equals(s)){//进行匹配
            return "进入站点";
        }else {

            return "申请成为站点";

        }
    }
    //站长申请
    @GetMapping("/tationmaster")
    public String saveStationmaster(ZdbUser user, @Param("schoolid") Integer id ) {
        ZdbUser zdbUser = new ZdbUser(); //获取用户对象
        Integer schoolid = zdbUser.getSchoolid(); //获取用户的站点id
        Biuding biuding = new Biuding();//获取站点对象
        String s = biuding.getsId();//获取站点信息
        if (schoolid.equals(s)){//进行匹配
            return "进入站点";
        }else {
            user.setSchoolid(id);//添加站点id
            iSiteaService.Adsenseapplication(user);//添加信息
            return "填写信息";

        }

    }
}

